Upstream Wrangling

I loved this data visualization. The analysis was relatively easy, but introduced me to timeseries data. This sort of post exemplifies the visual style I plan to bring in future work.

Dylan true
03-15-2021

Overview

NOAA’s Historic Fisheries Collection Location: Oregon, Oregon City. -engaging photo

Summary

The Columbia River Basin watershed is home to several species of salmonids, inlcuding Sockeye, Coho, Jack Coho, Steelhead, and Wild Steelhead. Columbia River DART (Data Access in Real Time) provides comprehensive population and environmental data for 10 species in multiple survey locations in the basin over the last 100 years. In this report, we utilize the DART data to visualize population and adult passage trends for Coho, Jack Coho, and Steelhead in the Willamette Falls region.

-map of fish ladder

code
# Read in data
fish_raw <- read_csv(here("_posts", "2021-03-15-upstream-wrangling", "data", "willamette_fish_passage.csv"))
# Make a subset with coho, steelhead, jack coho

fish_sub <- fish_raw %>% 
  clean_names() %>% 
  select(project, date, coho, jack_coho, steelhead) 

# Create time series
fish_ts <- fish_sub %>% 
  mutate(date = mdy(date)) %>% 
  as_tsibble(key = NULL, index = date)

Visualizations

Time Series

code
# Tab 1 - time series graph

# Replace na values with 0
fish_ts_na <- fish_ts %>% 
  replace(is.na(.), 0)

# Create ts graph, but in separate panels
ts_coho <- ggplot(data = fish_ts_na) +
  geom_line(aes(x = date, y = coho), color = "red") +
  labs(y = "Coho Count", x = "Year") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 90))

ts_steelhead <- ggplot(data = fish_ts_na) +
  geom_line(aes(x = date, y = steelhead), color = "blue") +
  labs(y = "Steelhead Count", x = "Year") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 90))

ts_jack_coho <- ggplot(data = fish_ts_na) +
  geom_line(aes(x = date, y = jack_coho), color = "green") +
  labs(y = "Jack Coho Count", x = "Year") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 90))

library(patchwork)

ts_coho | ts_steelhead | ts_jack_coho 

Figure 1. Shows visual counts of Coho (red),Steelhead (blue), and Jack Coho (green) in adult passages in the Willamette Falls Columbia River DART survey location. Observations were taken daily from 2001 to 2010.

Time Series Takeaways

Data: Columbia River Basin DART Adult Passage Graphics & Text | Columbia Basin Research. http://www.cbr.washington.edu/dart/query/adult_graph_text.

Seasonplots

Figure 2. Daily Counts of Coho, Jack Coho, and Steelhead at Willamette Falls

code
# Create Seasonplot showing value (counts) for each day over entire span of data, store as object
final <- annual_fish %>% 
  gg_season(y = value) +  
  facet_wrap(~species, ncol = 1, scales = "free") %>% 
  labs(x = "Month", y = "Counts")

final

Figure 2. shows visual counts of Coho, Jack Coho, and Steelhead in adult passages in the Willamette Falls Columbia River DART survey location. Observations were taken daily from 2001 to 2010.

Seasonplots Takeaways

Data: Columbia River Basin DART Adult Passage Graphics & Text | Columbia Basin Research. http://www.cbr.washington.edu/dart/query/adult_graph_text.

Annual counts

From Here, I’ll make a plot of annual salmon and steelhead runs by year.

code
annual_fish <- fish_ts %>%
  mutate(year = year(date)) %>% 
pivot_longer(`coho`:`steelhead`,
               names_to = "species",
               values_to = "value") %>% 
  group_by(species) %>% 
index_by(year) %>% 
summarize(total = sum(value, na.rm = TRUE))

Now, let’s plot this!

code
ggplot(data = annual_fish, aes(x = year, y = total, color = species)) + 
  geom_line() +
 scale_color_manual(values=c("deeppink2", "blue2", "goldenrod")) +
  geom_point(size = 2,
             alpha = 0.8) +
  scale_x_continuous(breaks = c(2000, 2002, 2004, 2006, 2008, 2010)) +
  labs( x = "Year",
        y = "Annual Fish Observations",
        color = "Species",
        title = "Willamette Falls Annual Salmonoid Counts") +
  theme_bw()

Figure 3: Counts for three salmonoid species, totaled annually, from the Willamette Falls observation site.

Data: Columbia River Basin DART Adult Passage Graphics & Text | Columbia Basin Research. http://www.cbr.washington.edu/dart/query/adult_graph_text.